<template>
  <div>
    <h1 style="margin-top: 50px;">网站评分</h1>
    <div style="font-size: 18px;margin-top: 30px;">
      <span>1.请问您对英雄联盟皮肤销售网站满意吗？</span>
      <el-rate v-model="value4" show-text></el-rate><br>
      <span>2.请问您的身份是什么？</span><br>
      <template>
        <el-radio v-model="radio" label="1">学生</el-radio>
        <el-radio v-model="radio" label="2">上班族</el-radio>
        <el-radio v-model="radio" label="3">教师</el-radio>
        <el-radio v-model="radio" label="4">其它</el-radio>
      </template><br><br>
      <span>3.请问您对英雄联盟皮肤销售网站满意吗？</span><br>
      <el-rate v-model="value2" show-text></el-rate><br>
      <span>4.请问您对英雄联盟皮肤销售网站满意吗？</span><br>
      <el-rate v-model="value3" show-text></el-rate><br>
      <span>5.请问您对英雄联盟皮肤销售网站满意吗？</span><br>
      <el-rate v-model="value1" show-text></el-rate><br>
      <span>6.还有什么话想对制作者说？</span><br>
      <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入内容"
          v-model="textarea">
      </el-input>
      <el-button type="primary" style="margin-top: 20px;" @click="">提交建议</el-button>
    </div>

  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  computed: {
    http() {
      return http
    }
  },
  data() {
    return {
      value1: 1,
      value2: 2,
      value3: 3,
      value4: 4,
      value5: 5,
      params: {
        name: '',
        author: '',
        pageNum: 1,
        pageSize: 5,
      },
      tableData: [],
      total: 0,
      dialogFormVisible: false,
      form: {},
      formLabelWidth: '80px',
    }
  },

  created() {
    this.findBySearch()
  },

  methods: {
    findBySearch(){
      request.get("/book/search", {
        params: this.params
      }).then(res =>{
        if(res.code === '0'){
          this.tableData = res.data.list;
          this.total = res.data.total;
        }else{
          this.$message.error(res.msg);
        }
      })
    },

    add(){
      this.form = {};
      this.dialogFormVisible = true
    },
    edit(obj){
      this.form = obj;
      this.dialogFormVisible = true
    },
    down(flag){
      location.href = "http://localhost:8080/api/files/" + flag.img
    },

    reset(){
      this.params = {
        pageNum: 1,
        pageSize: 5,
        name: '',
        phone: '',
      }
      this.findBySearch();
    },
    handleSizeChange(pageSize){
      this.params.pageSize = pageSize;
      this.findBySearch();
    },
    handleCurrentChange(pageNum){
      this.params.pageSize = pageNum;
      this.findBySearch();
    },
    submit(){
      request.post("/book", this.form).then(res =>{
        if(res.code === "0"){
          this.$message.success("操作成功");
          this.dialogFormVisible = false;
          this.findBySearch();
        }else{
          this.$message.error(res.msg);
        }
      })
    },
    del(id){
      request.delete("/book/" + id).then(res => {
        if (res.code === "0") {
          this.$message.success("删除成功");
          this.findBySearch();
        } else {
          this.$message.error(res.msg);
        }
      })
    },
    successUpload(res){
      console.log(res);
      this.form.img = res.data;
    }
  }
}
</script>
